home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 December / 2004-12 CHIP.iso / CHIP / Porady / Srodowisko PHP-MySQL / WAMP5 1.3 / wamp5_1.3.exe / {app} / www / phpmyadmin / themes.php < prev    next >
PHP Script  |  2004-09-24  |  7KB  |  153 lines

  1. <?php
  2. /* get some globals */
  3. require_once('./libraries/grab_globals.lib.php');
  4. require_once('./libraries/common.lib.php');
  5.  
  6. /* Theme Select */
  7. $path_to_themes = './' . $cfg['ThemePath'] . '/';
  8. require_once('./libraries/select_theme.lib.php');
  9.  
  10. /* set language and charset */
  11. require_once('./libraries/header_http.inc.php');
  12.  
  13. /* Gets the font sizes to use */
  14. PMA_setFontSizes();
  15. /* remove vertical scroll bar bug in ie */
  16. echo "<?xml version=\"1.0\" encoding=\"" . $GLOBALS['charset'] . "\"?".">";
  17. ?>
  18. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  19.     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  20. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][2]; ?>" lang="<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][2]; ?>" dir="<?php echo $GLOBALS['text_dir']; ?>">
  21.  
  22. <head>
  23. <title>phpMyAdmin <?php echo PMA_VERSION; ?></title>
  24. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $GLOBALS['charset']; ?>" />
  25. <meta http-equiv="imagetoolbar" content="no">
  26. <script language="JavaScript" type="text/javascript">
  27. <!--
  28.     /* added 2004-06-10 by Michael Keck
  29.      *       we need this for Backwards-Compatibility and resolving problems
  30.      *       with non DOM browsers, which may have problems with css 2 (like NC 4)
  31.     */
  32.     var isDOM      = (typeof(document.getElementsByTagName) != 'undefined'
  33.                       && typeof(document.createElement) != 'undefined')
  34.                    ? 1 : 0;
  35.     var isIE4      = (typeof(document.all) != 'undefined'
  36.                       && parseInt(navigator.appVersion) >= 4)
  37.                    ? 1 : 0;
  38.     var isNS4      = (typeof(document.layers) != 'undefined')
  39.                    ? 1 : 0;
  40.     var capable    = (isDOM || isIE4 || isNS4)
  41.                    ? 1 : 0;
  42.     // Uggly fix for Opera and Konqueror 2.2 that are half DOM compliant
  43.     if (capable) {
  44.         if (typeof(window.opera) != 'undefined') {
  45.             var browserName = ' ' + navigator.userAgent.toLowerCase();
  46.             if ((browserName.indexOf('konqueror 7') == 0)) {
  47.                 capable = 0;
  48.             }
  49.         } else if (typeof(navigator.userAgent) != 'undefined') {
  50.             var browserName = ' ' + navigator.userAgent.toLowerCase();
  51.             if ((browserName.indexOf('konqueror') > 0) && (browserName.indexOf('konqueror/3') == 0)) {
  52.                 capable = 0;
  53.             }
  54.         } // end if... else if...
  55.     } // end if
  56.     document.writeln('<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : './'; ?>css/phpmyadmin.css.php?lang=<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][2]; ?>&js_frame=right&js_isDOM=' + isDOM + '" />');
  57. //-->
  58. </script>
  59. <noscript>
  60.     <link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : './'; ?>css/phpmyadmin.css.php?lang=<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][2]; ?>&js_frame=right" />
  61. </noscript>
  62. <script language="JavaScript">
  63. <!--
  64.     function takeThis(what){
  65.         if (window.opener && window.opener.document.forms['setTheme'].elements['set_theme']) {
  66.             window.opener.document.forms['setTheme'].elements['set_theme'].value = what;
  67.             window.opener.document.forms['setTheme'].submit();
  68.             self.close();
  69.         } else {
  70.             alert('No theme support, please check your configs\nand/or your themes in <?php echo './' . $cfg['ThemePath']; ?>');
  71.             self.close();
  72.         }
  73.     }
  74. //-->
  75. </script>
  76. </head>
  77.  
  78. <body bgcolor="<?php echo $cfg['RightBgColor']; ?>">
  79.     <table border="0" align="center" cellpadding="3" cellspacing="1">
  80.         <tr>
  81.             <th class="tblHeaders"><b>phpMyAdmin - <?php echo ($strTheme ? $strTheme : 'Theme / Style'); ?></b></th>
  82.         </tr>
  83.         <tr>
  84.             <td><img src="<?php echo $GLOBALS['pmaThemeImage'] . 'spacer.png'; ?>" width="1" height="1" border="0" alt="" /></td>
  85.         </tr>
  86.         <?php
  87. if ($handleThemes = opendir($path_to_themes)) { // open themes
  88.     while (false !== ($PMA_Theme = readdir($handleThemes))) {  // get screens
  89.         if ($PMA_Theme != "." && $PMA_Theme != "..") {
  90.             $screen_directory = $path_to_themes . $PMA_Theme;
  91.  
  92.             // check for theme requires/name
  93.             unset($theme_name, $theme_generation, $theme_version);
  94.             @include($path_to_themes . $PMA_Theme . '/info.inc.php');
  95.  
  96.             // did it set correctly?
  97.             if (!isset($theme_name, $theme_generation, $theme_version))
  98.                 continue; // invalid theme
  99.  
  100.             if ($theme_generation != PMA_THEME_GENERATION)
  101.                 continue; // different generation
  102.  
  103.             if ($theme_version < PMA_THEME_VERSION)
  104.                 continue; // too old version
  105.  
  106.  
  107.             if (is_dir($screen_directory) && @file_exists($screen_directory.'/screen.png')) { // if screen exists then output
  108.         ?>
  109.         <tr>
  110.             <th align="left">
  111.                 <?php
  112.                 echo '<b>' . htmlspecialchars($theme_name) . '</b>';
  113.                 ?>
  114.             </th>
  115.         </tr>
  116.         <tr>
  117.             <td align="center" bgcolor="<?php echo $cfg['BgcolorOne']; ?>" class="navNorm">
  118.                 <script language="JavaScript">
  119.                 <!--
  120.                     document.write('<a href="#top" onclick="takeThis(\'<?php echo $PMA_Theme; ?>\'); return false;">');
  121.                     document.write('<img src="<?php echo $screen_directory; ?>/screen.png" border="1" ');
  122.                     if (document.getElementById) {
  123.                         document.write('style="border: 1px solid #000000;" ');
  124.                     }
  125.                     document.write('alt="<?php echo htmlspecialchars(addslashes($theme_name)); ?> - Theme" ');
  126.                     document.write('title="<?php echo htmlspecialchars(addslashes($theme_name)); ?> - Theme" />');
  127.                     document.write('</a><br />');
  128.                     document.write('[ <b><a href="#top" onclick="takeThis(\'<?php echo $PMA_Theme; ?>\'); return false;">');
  129.                     document.write('<?php echo addslashes($strTakeIt); ?>');
  130.                     document.write('</a></b> ]');
  131.                 //-->
  132.                 </script>
  133.                 <noscript>
  134.                     <?php
  135.                 echo '<img src="' . $screen_directory . '/screen.png" border="1" alt="' . htmlspecialchars($theme_name) . ' - Theme" />';
  136.                     ?>
  137.                 </noscript>
  138.             </td>
  139.         </tr>
  140.         <tr>
  141.             <td><img src="<?php echo $GLOBALS['pmaThemeImage'] . 'spacer.png'; ?>" width="1" height="1" border="0" alt="" /></td>
  142.         </tr>
  143. <?php
  144.             } // end 'screen output'
  145.         } // end 'check theme'
  146.     } // end 'get screens'
  147.     closedir($handleThemes);
  148. } // end 'open themes'
  149. ?>
  150.     </table>
  151. </body>
  152. </html>
  153.